﻿using System;
using System.Linq;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
using MyFinanceManager.Objects;
using MyFinanceManager.Controls;

namespace MyFinanceManager
{
    public partial class ucFuelstation : FiringUserControl
    {
        public string Value
        {
            get
            {
                if (this.listBox1.SelectedItem != null)
                    return this.listBox1.SelectedItem.ToString();
                return "";
            }
        }

        public ucFuelstation()
        {
            InitializeComponent();

            foreach (var item in Database.NamesOfFuelstations)
            {
                this.listBox1.Items.Add(item);
            }

            this.listBox1.SelectedIndexChanged += new EventHandler(listBox1_SelectedIndexChanged);
        }

        void listBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            FireNewValueAvailable(this.Value);
        }
    }
}
